//
//  CinemaListTableViewCell.m
//  豆瓣
//
//  Created by dllo on 15/10/27.
//  Copyright (c) 2015年 蓝鸥科技. All rights reserved.
//

#import "CinemaListTableViewCell.h"

@interface CinemaListTableViewCell ()

@end

@implementation CinemaListTableViewCell

- (void)dealloc
{
    [_nameLabel release];
    [_telephoneLabel release];
    [_addressLabel release];
    [super dealloc];
}

- (void)awakeFromNib {
    // Initialization code
}

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        [self createSubViews];
    }
    return self;
}

-(void)createSubViews
{
    self.aImage = [[UIImageView alloc]initWithFrame:CGRectMake(15, 10, 345, 180)];
    self.aImage.image = [UIImage imageNamed:@"bg_eventlistcell.png"];
    [self.contentView addSubview:self.aImage];
    [self.aImage release];
    
    
    self.nameLabel = [[UILabel alloc]initWithFrame:CGRectMake(20, 15, 335, 40)];
    [self.contentView addSubview:self.nameLabel];
    [_nameLabel release];
    
    
    self.addressLabel = [[UILabel alloc]initWithFrame:CGRectMake(20, 70, 335, 40)];
    [self.contentView addSubview:self.addressLabel];
    self.addressLabel.numberOfLines = 0;
    [self.addressLabel release];
    
    
    self.telephoneLabel = [[UILabel alloc]initWithFrame:CGRectMake(20, 125, 335, 40)];
    [self.contentView addSubview:self.telephoneLabel];
    [self.telephoneLabel release];
    
}

- (void)setMyCinema:(Cinema *)myCinema
{
    if (_myCinema != myCinema) {
        [_myCinema release];
        _myCinema = [myCinema retain];
    }
    self.nameLabel.text = self.myCinema.cinemaName;
    self.addressLabel.text = self.myCinema.address;
    self.telephoneLabel.text = self.myCinema.telephone;
    
    [self.addressLabel sizeToFit];
    
}


- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
